package com.wdwmcs.cicd.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/cicd")
public class CicdController {
    @Autowired
    ConfigurableApplicationContext context;

    @GetMapping("/hello")
    public String test(){
        Environment environment = context.getBean(Environment.class);
        String port = environment.getProperty("local.server.port");
        return "Hello CICD "+port;
    }
}
